/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.vivo.dealer.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.thinkgem.jeesite.common.persistence.TreeEntity;

/**
 * 经销商关系Entity
 * @author jyangye
 * @version 2017-11-08
 */
public class VivoDealerRelation extends TreeEntity<VivoDealerRelation> {
	
	private static final long serialVersionUID = 1L;
	private VivoDealerRelation parent;		// 父级编号
	private String parentIds;		// 所有父级编号
	private String dealerId;		// dealer_id
	private String parentDealerId;		// parent_dealer_id
	private Integer sort;		// 排序
	private String code;		// 编码
	private String depth;		// 级次深度
	private String isClose;		// 是否已关闭
	private Date closeDate;		// 关闭日期
	private String closeUserName;		// 关闭人姓名
	private String closeReason;		// close_reason
	private String showOrderCode;		// 显示序列编号

    private ViDealerInfo vd;

    public ViDealerInfo getVd() {
        return vd;
    }

    public void setVd(ViDealerInfo vd) {
        this.vd = vd;
    }

    public VivoDealerRelation() {
		super();
	}

	public VivoDealerRelation(String id){
		super(id);
	}

	@JsonBackReference
	public VivoDealerRelation getParent() {
		return parent;
	}

	public void setParent(VivoDealerRelation parent) {
		this.parent = parent;
	}
	
	@Length(min=0, max=2000, message="所有父级编号长度必须介于 0 和 2000 之间")
	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}
	
	@Length(min=0, max=11, message="dealer_id长度必须介于 0 和 11 之间")
	public String getDealerId() {
		return dealerId;
	}

	public void setDealerId(String dealerId) {
		this.dealerId = dealerId;
	}
	
	@Length(min=0, max=11, message="parent_dealer_id长度必须介于 0 和 11 之间")
	public String getParentDealerId() {
		return parentDealerId;
	}

	public void setParentDealerId(String parentDealerId) {
		this.parentDealerId = parentDealerId;
	}
	
	@Length(min=0, max=11, message="排序长度必须介于 0 和 11 之间")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	@Length(min=0, max=30, message="编码长度必须介于 0 和 30 之间")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	@Length(min=0, max=11, message="级次深度长度必须介于 0 和 11 之间")
	public String getDepth() {
		return depth;
	}

	public void setDepth(String depth) {
		this.depth = depth;
	}
	
	@Length(min=0, max=1, message="是否已关闭长度必须介于 0 和 1 之间")
	public String getIsClose() {
		return isClose;
	}

	public void setIsClose(String isClose) {
		this.isClose = isClose;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCloseDate() {
		return closeDate;
	}

	public void setCloseDate(Date closeDate) {
		this.closeDate = closeDate;
	}
	
	@Length(min=0, max=20, message="关闭人姓名长度必须介于 0 和 20 之间")
	public String getCloseUserName() {
		return closeUserName;
	}

	public void setCloseUserName(String closeUserName) {
		this.closeUserName = closeUserName;
	}
	
	@Length(min=0, max=100, message="close_reason长度必须介于 0 和 100 之间")
	public String getCloseReason() {
		return closeReason;
	}

	public void setCloseReason(String closeReason) {
		this.closeReason = closeReason;
	}
	
	@Length(min=1, max=3, message="显示序列编号长度必须介于 1 和 3 之间")
	public String getShowOrderCode() {
		return showOrderCode;
	}

	public void setShowOrderCode(String showOrderCode) {
		this.showOrderCode = showOrderCode;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}